import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

// 按需导入Element Plus组件和样式
import {
  ElButton,
  ElCard,
  ElHeader,
  ElMain,
  ElUpload,
  ElTag,
  ElProgress,
  ElTable,
  ElTableColumn,
  ElPagination,
  ElSelect,
  ElOption,
  ElInputNumber,
  ElInput,
  ElForm,
  ElFormItem,
  ElMessage,
  ElNotification,
  ElIcon,
  ElConfigProvider,
} from 'element-plus'

// 导入Element Plus样式
import 'element-plus/dist/index.css'

// 导入全局样式
import './styles/global.css'

// 按需导入图标
import {
  UploadFilled,
  Document,
  SwitchButton,
  Download,
  Plus,
  User,
  Lock,
} from '@element-plus/icons-vue'

const app = createApp(App)

// 注册需要的组件
app.component('ElButton', ElButton)
app.component('ElCard', ElCard)
app.component('ElHeader', ElHeader)
app.component('ElMain', ElMain)
app.component('ElUpload', ElUpload)
app.component('ElTag', ElTag)
app.component('ElProgress', ElProgress)
app.component('ElTable', ElTable)
app.component('ElTableColumn', ElTableColumn)
app.component('ElPagination', ElPagination)
app.component('ElSelect', ElSelect)
app.component('ElOption', ElOption)
app.component('ElInputNumber', ElInputNumber)
app.component('ElInput', ElInput)
app.component('ElForm', ElForm)
app.component('ElFormItem', ElFormItem)
app.component('ElIcon', ElIcon)
app.component('ElConfigProvider', ElConfigProvider)

// 注册图标组件
app.component('UploadFilled', UploadFilled)
app.component('Document', Document)
app.component('SwitchButton', SwitchButton)
app.component('Download', Download)
app.component('Plus', Plus)
app.component('User', User)
app.component('Lock', Lock)

// 全局挂载消息组件（可选）
// app.config.globalProperties.$message = ElMessage
// app.config.globalProperties.$notify = ElNotification

app.use(router)

app.mount('#app')
